home *** CD-ROM | disk | FTP | other *** search
/ Power Programmierung 2 / Power-Programmierung CD 2 (Tewi)(1994).iso / gnu / djgpp / contrib / dvx / inc / x11 / xstreams.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-07-15  |  4.4 KB  |  184 lines

  1. /*
  2.  * $XConsortium: Xstreams.h,v 1.3 89/06/15 15:59:09 jim Exp $
  3.  */
  4.  
  5. #ifndef _XSTREAMS_H_
  6. #define _XSTREAMS_H_
  7.  
  8. #ifndef    NOIDENT
  9. #ident    "@(#)Xstreams.h    1.11"
  10. #endif
  11.  
  12. /*
  13.  * Copyright 1988, 1989 AT&T, Inc.
  14.  *
  15.  * Permission to use, copy, modify, and distribute this software and its
  16.  * documentation for any purpose and without fee is hereby granted, provided
  17.  * that the above copyright notice appear in all copies and that both that
  18.  * copyright notice and this permission notice appear in supporting
  19.  * documentation, and that the name of AT&T not be used in advertising
  20.  * or publicity pertaining to distribution of the software without specific,
  21.  * written prior permission.  AT&T makes no representations about the
  22.  * suitability of this software for any purpose.  It is provided "as is"
  23.  * without express or implied warranty.
  24.  *
  25.  * AT&T DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
  26.  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO EVENT SHALL AT&T
  27.  * BE LIABLE FOR ANY SPECIAL, INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
  28.  * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION
  29.  * OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN 
  30.  * CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
  31.  *
  32. */
  33.  
  34. /*
  35.  Xstreams.h (C header file)
  36.     Acc: 575304412 Tue Apr 26 09:46:52 1988
  37.     Mod: 574017273 Tue Apr 26 12:14:33 1988
  38.     Sta: 574017273 Tue Apr 26 12:14:33 1988
  39.     Owner: 2011
  40.     Group: 1985
  41.     Permissions: 644
  42. */
  43. /*
  44.     START USER STAMP AREA
  45. */
  46. /*
  47.     END USER STAMP AREA
  48. */
  49.  
  50.  
  51. #define    MAX_NETS    8
  52.  
  53. typedef struct _host {
  54.     char    host_name[32];
  55.     int    host_len;
  56.     struct _host *next;
  57. } HOST;
  58.  
  59. /*
  60.  * Structure for handling multiple connection requests on the same stream.
  61.  */
  62.  
  63. struct listenCall {
  64.     struct t_call *CurrentCall;
  65.     struct listenCall *NextCall;
  66. };
  67.  
  68. struct listenQue {
  69.     struct listenCall *QueHead;
  70.     struct listenCall *QueTail;
  71. };
  72.  
  73. #define EMPTY(p)    (p->QueHead == (struct listenCall *) NULL)
  74.  
  75.  
  76. typedef struct _IOBUFFER { /* Tagged. POHC 90/10/08 */
  77.     int    flags;
  78.     char    type;
  79.     int    display;
  80.     char    *inputbuf;
  81.     int    buflen;
  82.     int    bufptr;
  83.     int    msglen;
  84.     } IOBUFFER;
  85.  
  86. typedef struct _networkInfo { /* Tagged. POHC 90/10/08 */
  87.     int    _nnets;
  88.     char    *_net[MAX_NETS];
  89.         struct listenQue FreeList[MAX_NETS];
  90.     struct listenQue PendingQue[MAX_NETS];
  91.     int    _npeers;
  92.     char    **_peer;
  93.     int    *_peerlen;
  94.     HOST    *_validhosts;
  95.     } networkInfo;
  96.  
  97. typedef struct _Xstream {
  98.     int    (*SetupTheListener)();
  99.     int    (*ConnectNewClient)();
  100.     int    (*CallTheListener)();
  101.     int    (*ReadFromStream)();
  102.     int    (*BytesCanBeRead)();
  103.     int    (*WriteToStream)();
  104.     int    (*CloseStream)();
  105.     int    (*CreateAddress)();
  106.     union ext {
  107.         int    (*NameServer)();
  108.         networkInfo *NetInfo;
  109.         } u;    
  110.     } Xstream;
  111.  
  112. extern Xstream _XsStream[];
  113.  
  114.  
  115. #define NO_BUFFERING    0
  116. #define BUFFERING    1
  117.  
  118. /* Network services */
  119.  
  120. #define OpenDaemonConnection    0
  121. #define    PEER_NAME        1
  122. #define    PEER_ALLOC        2
  123. #define    PEER_FREE        3
  124. #define    ConvertNetAddrToName    4
  125. #define    ConvertNameToNetAddr    5
  126. #define    ConvertNameToTliCall    6
  127. #define    ConvertTliCallToName    7
  128. #define    ConvertNameToTliBind    8
  129.  
  130. #define    UNAME_LENGTH    14
  131.  
  132. #define X_LOCAL_STREAM    0
  133. #define X_TLI_STREAM    1
  134. #define CLOSED_STREAM    -1
  135.  
  136. /*
  137.     The following are defined in X.h. Any changes to FamilyUname
  138.     should take X.h into consideration.
  139. */
  140.         /* protocol families */
  141.  
  142.         /*
  143.  
  144.         #define FamilyInternet        0
  145.         #define FamilyDECnet        1
  146.         #define FamilyChaos        2
  147.  
  148.         */
  149.  
  150. #define FamilyUname    3
  151.  
  152. #define X_TCP_PORT        6000
  153.  
  154. #ifdef MSDOS /* POHC 90/09/17 */
  155. #define XROOTDIR    "\\"
  156. #else
  157. #define LOCAL_LISTENER "/dev/X/server"
  158. #define    NAME_SERVER_NODE "/dev/X/nameserver"
  159. #define XNETSPECDIR    "/usr/X/lib/net"
  160. #define XROOTDIR    "/usr/X"
  161. #endif
  162.  
  163. #define    MAX_SIMUL_TLI_CALLS    20
  164.  
  165. #define SetupNetworkInfo()    _XsStream[X_LOCAL_STREAM].u.NetInfo = &Network; \
  166.     _XsStream[X_TLI_STREAM].u.NameServer = nameserver
  167.  
  168. #define NetworkInfo (_XsStream[X_LOCAL_STREAM].u.NetInfo)
  169. #define GetNetworkInfo (*_XsStream[X_TLI_STREAM].u.NameServer)
  170. #define validhosts ((HOST *) _XsStream[X_LOCAL_STREAM].u.NetInfo->_validhosts)
  171.  
  172. /*
  173.  *    header of messages sent by X to the nameserver 
  174.  *      1st int: the size of the entire message.
  175.  *    2nd int: the size of the header itself.
  176.  *      3rd int: the service number.
  177.  *      4th int: the display number.
  178.  *     5th int: the length of the network name.
  179.  */
  180.  
  181. #define HEADERSIZE    (5*sizeof(int))
  182.  
  183. #endif /* _XSTREAMS_H_ */
  184.